home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
Init.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
4KB
|
165 lines
#include "stdafx.h"
cBMP *backgr, *ambient1, *ambient2;
cImage *deaths_icon = 0, *mine_icon = 0, *spread_gun_icon = 0, *jetpack_icon = 0,
*rocket_icon = 0, *in_game_pointer = 0, *thumper_icon = 0;
char *cmap_gray = 0;
cProperties *mine, *bullet, *rocket, *thumper, *water_drop;
cRandomList bubble_list, falling_list, pushable_falling_list, crate_list,
crate_contents_list, hurting_list, inflamable_contents_list,
machine_contents_list, parts_list;
cSurface *back_surface = 0, *game_surface = 0, *left_surface = 0,
*right_surface = 0, *info_surface = 0;
static cParse *parsed_properties_file = 0;
void init_game_data()
{
// Make gravity?
if (!file_exists("Gravity.dat"))
create_gravity();
// Load gravity
cData::load("Gravity.dat");
// Recreate wave files?
if (!file_exists("Wave.dat"))
cWAV::create_file();
// Load wave files
cWAV::load();
// Make colormaps?
if (!file_exists("CMaps.dat"))
create_colormaps();
// Load colormaps
cData::load("CMaps.dat");
// Recreate bitmaps?
if (!file_exists("Bitmaps.dat"))
cBMP::create_file();
// Load bitmaps
cBMP::load();
// Create surfaces in order of importance
left_surface = new cLeftSurface();
right_surface = new cRightSurface();
if (no_parallax)
{
game_surface = new cNonParallaxSurface();
back_surface = game_surface;
}
else
{
game_surface = new cGameSurface();
back_surface = new cBackSurface();
}
if (inawin || debug)
info_surface = new cInfoSurface();
// Some standard things
cmap_gray = (char *)cData::get("GRAY");
backgr = cBMP::get("BACKGR");
ambient1 = cBMP::get("AMBIENT1");
ambient2 = cBMP::get("AMBIENT2");
deaths_icon = new cImage(cBMP::get("ICON_DEATHS"));
mine_icon = new cImage(cBMP::get("ICON_MINE"));
spread_gun_icon = new cImage(cBMP::get("ICON_SPREAD_GUN"));
jetpack_icon = new cImage(cBMP::get("ICON_JETPACK"));
rocket_icon = new cImage(cBMP::get("ICON_ROCKET"));
thumper_icon = new cImage(cBMP::get("ICON_THUMPER"));
in_game_pointer = new cImage(cBMP::get("IN_GAME_POINTER"));
in_game_pointer->origin_center();
// Parse properties file
cParse::parse_file("WATER.BDS", &parsed_properties_file);
// Create property objects
cProperties::create_all(parsed_properties_file);
// Define standard properties
mine = cProperties::find_w_error("MINE", "MINE");
bullet = cProperties::find_w_error("BULLET", "BULLET");
rocket = cProperties::find_w_error("ROCKET", "ROCKET");
thumper = cProperties::find_w_error("THUMPER", "THUMPER");
water_drop = cProperties::find_w_error("FALLING SCENERY", "WATER DROP");
// Define random lists
bubble_list.add_to_list("BUBBLE");
crate_contents_list.add_to_list("FALLING", "FLARE");
inflamable_contents_list.add_to_list("HURTING");
machine_contents_list.add_to_list("ROLLING");
parts_list.add_to_list("PARTS");
}
void deinit_game_data()
{
// Remove parsed properties file
parsed_properties_file->delete_list();
// Remove properties objects
props->delete_list();
// Remove random lists
bubble_list.delete_list();
crate_contents_list.delete_list();
inflamable_contents_list.delete_list();
machine_contents_list.delete_list();
parts_list.delete_list();
// Delete surfaces
safe_delete(&left_surface);
safe_delete(&right_surface);
safe_delete(&game_surface);
safe_delete(&info_surface);
if (!no_parallax)
safe_delete(&back_surface);
// Delete standard allocated images
safe_delete(&deaths_icon);
safe_delete(&mine_icon);
safe_delete(&spread_gun_icon);
safe_delete(&jetpack_icon);
safe_delete(&rocket_icon);
safe_delete(&thumper_icon);
safe_delete(&in_game_pointer);
// Clear memory from bitmaps etc.
wave->delete_list();
bitmaps->delete_list();
data->delete_list();
}